import { BasicColumn, FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
import { DescItem } from '/@/components/Description/index';
import { useI18n } from '/@/hooks/web/useI18n';
const { t } = useI18n('');

export const columns: BasicColumn[] = [
  {
    title: t('订阅者标识'),
    dataIndex: 'code',
    width: 140,
  },
  {
    title: t('订阅者名称'),
    dataIndex: 'name',
    width: 140,
  },
  {
    title: t('通知方式'),
    dataIndex: 'notifyWay',
    width: 120,
  },
  {
    title: t('通知地址'),
    dataIndex: 'notifyUrl',
    width: 200,
  },
  {
    title: t('创建时间'),
    dataIndex: 'createdAt',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [
  {
    // label: t('code'),
    field: 'keyword',
    component: 'Input',
    componentProps: {
      placeholder: "请输入标识/名称",
    },
  },
];



export const inputFormSchemas: FormSchema[] = [
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
  {
    label: t('订阅者标识'),
    required: true,
    field: 'code',
    component: 'Input',
    dynamicDisabled: ({ values }) => {
      return !!values.id
    },
    componentProps: {
      maxlength: 200,
    },

  },
  {
    label: t('订阅者名称'),
    required: true,
    field: 'name',
    component: 'Input',
    componentProps: {
      maxlength: 300,
    },

  },
  {
    label: t('通知方式'),
    required: true,
    field: 'notifyWay',
    component: "JDictSelectTag",
    componentProps: {
      dictType: "evb_subscriberNotifyWay",
      placeholder: "请选择"
    },

  },
  {
    label: t('通知地址'),
    required: true,
    field: 'notifyUrl',
    component: 'Input',
    componentProps: {
      maxlength: 300,
    },

  },
  {
    label: t('备注'),
    field: 'remark',
    required: false,
    component: 'InputTextArea',
    componentProps: {
      maxlength: 500,
      autoSize: {
        minRows: 4,
        maxRows: 8,
      },
    },
    colProps: { lg: 24, md: 24 },
  },
];


export const formDetailSchema: DescItem[] = [
  {
    label: t('标识'),
    field: 'code'
  },
  {
    label: t('名称'),
    field: 'name'
  },
  {
    label: t('通知方式'),
    field: 'notifyWay'
  },
  {
    label: t('通知地址'),
    field: 'notifyUrl'
  },
  {
    label: t('备注'),
    labelMinWidth: 40,
    field: 'remark',
  },
  {
    label: t('创建时间'),
    field: 'createdAt'
  },
  {
    label: t('创建者'),
    field: 'createdBy'
  },
  {
    label: t('更新时间'),
    field: 'updatedAt'
  },
  {
    label: t('更新者'),
    field: 'updatedBy'
  },
];
